<template>
	<view>
		<up-cell-group class="mt20">
			<up-cell icon="file-text-fill" title="隐私政策" :isLink="true"></up-cell>
			<up-cell icon="info-circle-fill" title="当前版本" :isLink="true"></up-cell>
			<up-cell icon="chat-fill" title="消息中心" :isLink="true" @click="toMessage"></up-cell>
			<up-cell icon="setting-fill" title="权限管理" :isLink="true" @click="openSetting"></up-cell>
			<up-cell icon="integral-fill" title="退出登录" :isLink="true" @click="logout"></up-cell>
		</up-cell-group>
		<!-- <up-button type="primary" color="#000" text="退出登陆" @click="logout"></up-button> -->
	</view>
</template>

<script setup>
import { postRequest } from "@/reuqest/request.js";

const openSetting = () => {
	uni.openSetting({

	})
}

const toMessage = () => {
	uni.switchTab({
		url: '/pages/message/message'
	})
}

const logout = () => {
	uni.showModal({
		title: '提示',
		content: '确定要退出登陆吗？',
		success: (res) => {
			if (res.confirm) {
				postRequest("/wx-user-center/api/v1/bm/login/logout", {}).then(res => {
					uni.removeStorageSync('token')
					uni.removeStorageSync('userInfo')
					uni.reLaunch({
						url: '/pages/login/login'
					})
				})
			}
		}
	})
}
</script>

<style lang="scss" scoped>
::v-deep .u-cell__body {
	padding: 20px 15px !important;
}
</style>